<?php
$page = 'Admin';
$in_site = 'dassnfu';
$loginVereist = 1;
//$overigeVariabelen['paginaNietAf'] = true;
include($_SERVER['DOCUMENT_ROOT']."/start.php");

//Heb je wel het recht om deze pagina te bekijken?
if($mainClass->spelerId <> 2) {
	include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
	include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");
	echo "<div id='main'><div id='submain'><div class='content'><div class='subcontent'>
		<div class='content_header'><h1>Admin dingetjes</h1></div>
		<div class='content_main'>";
	echo "<div class='error'><p class='icon'>Je hebt niet het recht om deze pagina te bekijken.</p></div>";
	echo "</div></div></div></div></div>";	//content_main, sub_content, content, sub_main, main
	include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
	die();
}

$bestanden = "<link rel='stylesheet' type='text/css' href='/bestanden/css/style_tabellen".$style_nmr.".css' />";

include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/my_query.php");
include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");

echo $mainClass->showPageStart();

//$result = mysql_query("SELECT spelerId, voornaam, tussenvoegsel, achternaam, emailBevestigd, laatst_ingelogd
				//FROM Speler
				//ORDER BY laatst_ingelogd DESC");
$myQuery->resetValues();
$myQuery->tabel = "Speler";
$myQuery->attributen = "spelerId, voornaam, tussenvoegsel, achternaam, emailBevestigd, laatst_ingelogd";
$myQuery->orderBy = "laatst_ingelogd DESC";
$myQuery->makeSelectQuery(true);
if(!$myQuery->isValidResult()) {
	echo $mainClass->placeError{"Er zijn geen spelers beschikbaar om weer te geven."};
}else {
	$row = $myQuery->result->fetchAll();
	echo "<table class='content padding' cellspacing='0'>";
		echo "<tr class='normaal".($color ? " alternate" : "")."'>";
			echo "<th style='width:100px;'>Naam</th>";
			echo "<th style='width:175px;'>Laatst ingelogd</th>";
		echo "</tr>";

		foreach($row AS $_row) {
		$color = false;
			if($_row['spelerId'] <> 1) {
				$color ? $color = false : $color = true;
				echo "<tr class='normaal".($color ? " alternate" : "")."'>";
					echo "<td class='left_align'>";
						echo $_row['voornaam']." ".(empty($_row['tussenvoegsel']) ? "" : $_row['tussenvoegsel']." ").$_row['achternaam']."</td>";
					echo "<td>";
						echo date("d-m-Y, H:i",strtotime ($_row['laatst_ingelogd']))." uur</td>";
				echo "</tr>";
			}				
		}
	echo "</table>";
}
echo $mainClass->showPageEnd();
include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
?>